package com.qgs.waf.gen;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisConnectionUtils;
import org.springframework.data.redis.core.RedisTemplate;

import com.google.gson.Gson;
import com.qgs.waf.jedis.RedisKeys;

public class GenAttackSummaryProvinceRelation {

	public static void test() {
		Gson gson = new Gson();
		ApplicationContext ac = new ClassPathXmlApplicationContext("classpath*:applicationContext*.xml", "classpath*:mybatis-*.xml");
		RedisTemplate rt = (RedisTemplate) ac.getBean("jedisTemplate");
		RedisConnectionFactory factory = rt.getConnectionFactory();
		RedisConnection redisConnection = RedisConnectionUtils.getConnection(factory);
		redisConnection.openPipeline();
		String provinces[] = new String[] { "辽宁省", "江苏省", "浙江省", "上海市","江西" };
		String industrys[] = new String[] { "金融", "法院", "政府", "民政", "税务", "其他" };
		redisConnection.hSet(RedisKeys.ATTACKSUMMARYPROVINCERELATION.getBytes(), provinces[0].getBytes(), Datas.getliaoninData().getBytes());
		redisConnection.hSet(RedisKeys.ATTACKSUMMARYPROVINCERELATION.getBytes(), provinces[1].getBytes(), Datas.getjiangsuData().getBytes());
		redisConnection.hSet(RedisKeys.ATTACKSUMMARYPROVINCERELATION.getBytes(), provinces[2].getBytes(), Datas.getzhejiangData().getBytes());
		redisConnection.hSet(RedisKeys.ATTACKSUMMARYPROVINCERELATION.getBytes(), provinces[3].getBytes(), Datas.getshanghaiData().getBytes());
		redisConnection.hSet(RedisKeys.ATTACKSUMMARYPROVINCERELATION.getBytes(), provinces[4].getBytes(), Datas.getjiangxiData().getBytes());
		List results = redisConnection.closePipeline();
		System.out.println(results);
		redisConnection.close();
		System.out.println("end ......");
	}

	public static void main(String[] args) {
		test();
	}

}
